//
//  YMStreamSocket.h
//  YMDemo
//
//  Created by admin on 2022/2/25.
//

#import <Foundation/Foundation.h>
#import "YMLiveStreamInfo.h"
#import "YMStreamingBuffer.h"
#import "YMLiveDebug.h"



@protocol YMStreamSocket;
@protocol YMStreamSocketDelegate <NSObject>

/** callback buffer current status (回调当前缓冲区情况，可实现相关切换帧率 码率等策略)*/
- (void)socketBufferStatus:(nullable id <YMStreamSocket>)socket status:(YMLiveBuffferState)status;
/** callback socket current status (回调当前网络情况) */
- (void)socketStatus:(nullable id <YMStreamSocket>)socket status:(YMLiveState)status;
/** callback socket errorcode */
- (void)socketDidError:(nullable id <YMStreamSocket>)socket errorCode:(YMLiveSocketErrorCode)errorCode;
@optional
/** callback debugInfo */
- (void)socketDebug:(nullable id <YMStreamSocket>)socket debugInfo:(nullable YMLiveDebug *)debugInfo;
@end

@protocol YMStreamSocket <NSObject>
- (void)start;
- (void)stop;
- (void)sendFrame:(nullable YMFrame *)frame;
- (void)setDelegate:(nullable id <YMStreamSocketDelegate>)delegate;
@optional
- (nullable instancetype)initWithStream:(nullable YMLiveStreamInfo *)stream;
- (nullable instancetype)initWithStream:(nullable YMLiveStreamInfo *)stream reconnectInterval:(NSInteger)reconnectInterval reconnectCount:(NSInteger)reconnectCount;
@end
